layui.use(['table', 'admin', 'ax', 'func'], function () {
    var $ = layui.$;
    var table = layui.table;

    /**
     * 数据库详情管理
     */
    var dbServiceList = {
        tableId: "dbServiceListTable"
    };

    /**
     * 初始化表格的列
     */
    dbServiceList.initColumn = function () {
        return [[
            {field: 'id', hide: true, title: 'id', style: 'background-color:#ffffff'},
            {
                field: 'rank',
                title: '序号',
                width: 100,
                align: 'center',
                templet: '#rank',
                style: 'background-color:#ffffff'
            },
            {field: '', align: '', width: 60, title: '', style: 'background-color:#ffffff'},
            {field: 'department', align: 'left', width: 180, title: '来源', style: 'background-color:#ffffff'},
            {field: 'dbName', align: 'left', title: '服务', width: 180, style: 'background-color:#ffffff'},
            {field: 'details', align: 'left', title: '描述', style: 'background-color:#ffffff'},
        ]];
    };

    // 渲染表格
    var tableResult = table.render({
        elem: '#' + dbServiceList.tableId,
        url: Feng.ctxPath + '/databaseListKh/searchServiceList?id=' + Feng.getUrlParam("id"),
        page: true,
        height: "full-158",
        cellMinWidth: 100,
        skin: 'line',
        cols: dbServiceList.initColumn(),
        done: function () {
            $('tr').css('background-color', '#ffffff');
        }
    });

    /**
     * 返回上一级界面
     */
    $("#returnDiv").on('click', '#returnButton', function () {
        history.go(-1)
    })
});
